	import tcdIO.Terminal;
	
	
		class DrunkSailorProgram {

	public static void main(String[] args) {

		Sailor[] theSailors;
		Terminal terminal1;
		int boat;
		int courtmartialed;
		int remain;
		
		theSailors = new Sailor[50];
		boat = 0;
		courtmartialed = 0;
		remain = 0;
		terminal1 = new Terminal("Drunken Sailor Simulator");
		
		int count = 0;
		for(int i = 0; i <= theSailors.length - 1; i++){
			theSailors[i] = new Sailor();
		while(theSailors[i].getFinalPosition() == 0 && count <= 999999){
			theSailors[i].update();
			count++;
		}
		if(theSailors[i].getFinalPosition() == 1){
			boat = boat + 1;
		}
		else if(theSailors[i].getFinalPosition() == 2){
			courtmartialed = courtmartialed + 1;
		}
		else if (theSailors[i].getFinalPosition() == 3){
			remain = remain + 1;
		}
	}
		
		terminal1.println("" + boat + " sailors made it onto the boat.");
		terminal1.println("" + courtmartialed + " sailors were court martialed.");
		terminal1.println("" + remain + " sailors remain in Whiskey.");


	}
}
